<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>登录系统</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css" rel="stylesheet">
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: '#165DFF',
                        secondary: '#0F3460',
                        accent: '#E94560',
                        light: '#F5F7FA',
                        dark: '#1A1A2E'
                    },
                    fontFamily: {
                        inter: ['Inter', 'system-ui', 'sans-serif'],
                    },
                }
            }
        }
    </script>
    <style type="text/tailwindcss">
        @layer utilities {
            .content-auto {
                content-visibility: auto;
            }
            .form-input-focus {
                @apply focus:ring-2 focus:ring-primary/50 focus:border-primary transition duration-200;
            }
            .btn-hover {
                @apply hover:shadow-lg hover:-translate-y-0.5 transition-all duration-300;
            }
            .card-shadow {
                box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.1);
            }
        }
    </style>
</head>
<body class="bg-gradient-to-br from-light to-blue-50 min-h-screen flex items-center justify-center p-4 font-inter text-dark">
<div class="w-full max-w-md">
    <div class="bg-white rounded-2xl card-shadow overflow-hidden">
        <div class="bg-primary p-6 text-white text-center relative overflow-hidden">
            <div class="absolute inset-0 bg-primary/20 opacity-30">
                <i class="fa fa-key absolute -top-10 -right-10 text-[150px] transform rotate-12"></i>
            </div>
            <div class="relative z-10">
                <h2 class="text-[clamp(1.5rem,3vw,2rem)] font-bold mb-2">用户登录</h2>
                <p class="text-primary-100">欢迎回来，请登录您的账户</p>
            </div>
        </div>

        <div class="p-8">
            <form th:action="@{/login}" method="post" class="space-y-5">
                <div class="space-y-2">
                    <label for="identifier" class="block text-sm font-medium text-gray-700">
                        <i class="fa fa-user-circle mr-2"></i>用户ID
                    </label>
                    <div class="relative">
                            <span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500">
                                <i class="fa fa-user"></i>
                            </span>
                        <input type="text" id="identifier" name="identifier" required
                               class="w-full pl-10 pr-4 py-3 rounded-lg border border-gray-300 form-input-focus outline-none"
                               placeholder="请输入用户ID">
                    </div>
                </div>

                <div class="space-y-2">
                    <label for="password" class="block text-sm font-medium text-gray-700">
                        <i class="fa fa-lock mr-2"></i>密码
                    </label>
                    <div class="relative">
                            <span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500">
                                <i class="fa fa-lock"></i>
                            </span>
                        <input type="password" id="password" name="password" required
                               class="w-full pl-10 pr-4 py-3 rounded-lg border border-gray-300 form-input-focus outline-none"
                               placeholder="请输入密码">
                    </div>
                </div>

                <div th:if="${error}" class="bg-red-50 border border-red-200 text-red-600 p-3 rounded-lg text-sm flex items-center">
                    <i class="fa fa-exclamation-circle mr-2"></i>
                    <span th:text="${error}">登录失败，请检查您的用户名和密码</span>
                </div>

                <button type="submit"
                        class="w-full bg-primary hover:bg-primary/90 text-white font-medium py-3 px-4 rounded-lg transition-all duration-300 transform btn-hover focus:outline-none focus:ring-2 focus:ring-primary/50 focus:ring-offset-2">
                    <i class="fa fa-sign-in mr-2"></i>登录
                </button>
            </form>

            <div class="mt-6 text-center">
                <div class="text-sm text-gray-600">
                    还没有账号? <a th:href="@{/register}" class="text-primary hover:text-primary/80 font-medium transition-colors">立即注册</a>
                </div>
                <div class="mt-3">
                    <a href="#" class="text-gray-500 hover:text-primary text-sm transition-colors">
                        <i class="fa fa-question-circle mr-1"></i>忘记密码?
                    </a>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    // 添加输入框动画效果
    document.querySelectorAll('input').forEach(input => {
        input.addEventListener('focus', () => {
            input.parentElement.classList.add('scale-[1.01]');
        });
        input.addEventListener('blur', () => {
            input.parentElement.classList.remove('scale-[1.01]');
        });
    });
</script>
</body>
</html>
